package cn.com.nxt.txb;

import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.Event;
import org.xutils.x;

import cn.com.nxt.txb.util.AppUtil;

@ContentView(R.layout.activity_download)
public class DownloadActivity extends BaseActivity {
    private String download;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        x.view().inject(this);//注解绑定
        download = getIntent().getStringExtra("url");
    }

    @Event({R.id.ll_iphone,R.id.ll_android})
    private void onViewClick(View v) {
        switch (v.getId()) {
            case R.id.ll_iphone:
            case R.id.ll_android:
                if(AppUtil.isBlank(download))
                    return;
                Intent intent = new Intent();
                intent.setAction("android.intent.action.VIEW");
                Uri content_url = Uri.parse(download);
                intent.setData(content_url);
                startActivity(intent);
                break;
        }
    }
}
